﻿using System;
using System.Xml.Serialization;
using System.Collections.Generic;

namespace VsxFactory.Modeling.Repository
{
    [Serializable]
    [XmlRoot(elementName:"manifest")]
    public class PackageManifest
    {
        /// <summary>
        /// Initializes a new instance of the <see cref="PackageManifest"/> class.
        /// </summary>
        /// <param name="Id">The id.</param>
        /// <param name="name">The name.</param>
        /// <param name="version">The version.</param>
        /// <param name="kind">The kind.</param>
        public PackageManifest(string name, string version, string kind) : this()
        {
            Guard.ArgumentNotNullOrEmptyString(name, "name");
            Guard.ArgumentNotNullOrEmptyString(version, "version");
            Guard.ArgumentNotNullOrEmptyString(kind, "kind"); 
            this.Name = name;
            this.Version = version;
            this.Kind = kind;
        }

        /// <summary>
        /// Initializes a new instance of the <see cref="PackageManifest"/> class.
        /// </summary>
        public PackageManifest()
        {
            Files = new List<string>();
        }

        /// <summary>
        /// Gets or sets the name.
        /// </summary>
        /// <value>The name.</value>
        public string Name { get; set; }
        /// <summary>
        /// Gets or sets the description.
        /// </summary>
        /// <value>The description.</value>
        public string Description { get; set; }
        /// <summary>
        /// Gets or sets the version.
        /// </summary>
        /// <value>The version.</value>
        public string Version { get; set; }

        [XmlArrayItem(elementName:"Author")]
        public List<string> Authors { get; set; }

        public bool RequireLicenseAcceptance { get; set; }

        public string LicenseUrl { get; set; }
        /// <summary>
        /// Gets or sets the kind.
        /// </summary>
        /// <value>The kind.</value>
        public string Kind { get; set; }
        /// <summary>
        /// Relative file paths to include in the package
        /// </summary>
        [XmlArrayItem(elementName:"File")]
        public List<string> Files { get; set; }
    }
}
